home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / compuserve-file-archive / 22 Graphics & Utilities / BASMOD.DOC < prev    next >
Encoding:
Text File  |  2019-04-13  |  5.9 KB  |  213 lines

  1.  
  2.        Documentation for BASMOD
  3.        ------------------------
  4.  
  5.  BASMOD is a modification by Joel Rubin
  6.  of a program  which  appeared  in  the
  7.  August 1983 COMPUTE! Gazette (Note  1)
  8.  which adds four new graphics  commands
  9.  to your Commodore 64.  It enables  you
  10.  to plot points on  a  high  resolution
  11.  screen  with  simple   commands   from
  12.  BASIC.
  13.  
  14.  What the Program Does
  15.  ---------------------
  16.  Part of BASMOD consists of  a  machine
  17.  language  routine  which  copies   the
  18.  BASIC ROM (Read  Only  Memory),  which
  19.  interprets BASIC  commands,  into  RAM
  20.  (Random  Access   Memory).    ROM   is
  21.  "permanent"  memory  -  that  is,  the
  22.  program stored in ROM is "burned" into
  23.  the ROM memory chip so that it is  not
  24.  lost when power is  removed  from  the
  25.  '64.    This    "permanent"    machine
  26.  language program, and its counterpart,
  27.  the KERNAL  ROM,  which  oversees  the
  28.  general  operation  of  the  '64,  are
  29.  essential to the function of all BASIC
  30.  programs; they tell the computer  what
  31.  it should do when it  "sees"  a  BASIC
  32.  command such as PRINT or LOAD,  either
  33.  in a program  or  typed  in  from  the
  34.  keyboard ("immediate" mode).
  35.  
  36.  However, there are several commands in
  37.  CBM BASIC  that  are  rarely  used  by
  38.  programmers, and virtually no commands
  39.  for creating high-resolution graphics.
  40.  Wouldn't  it  be  nice  if  we   could
  41.  replace  those  unused  commands  with
  42.  some that would let us easily use  the
  43.  hi-res screen, without all those peeks
  44.  and pokes?
  45.  
  46.  Since we can't change the  BASIC  ROM,
  47.  we must first "copy" it into RAM.  RAM
  48.  can be changed easily;  this  is  what
  49.  you're doing when you  POKE  a  number
  50.  into a memory location.   If  we  copy
  51.  ROM into RAM, change  the  appropriate
  52.  routines, and then tell the '64 to use
  53.  the new instructions in RAM instead of
  54.  ROM, we can  change  those  unused  to
  55.  commands  to  do  almost  anything  we
  56.  like!
  57.  
  58.  BASMOD does just that.  After  copying
  59.  ROM  into  RAM   (lines   30-34),   it
  60.  replaces the following BASIC commands:
  61.  
  62.        LET becomes HUE;
  63.        WAIT becomes PLOT;
  64.        CONT becomes WIPE; and
  65.        VERIFY becomes SCREEN.
  66.  
  67.  
  68.  USING BASMOD
  69.  ------------
  70.  Here's how to use the new commands:
  71.  
  72.  SCREEN
  73.  ------
  74.  SCREEN is used to switch  between  the
  75.  normal  text  screen   (beginning   at
  76.  memory   location    1024)    and    a
  77.  high-resolution screen  (beginning  at
  78.  8192).  The  contents  of  one  screen
  79.  will not affect  the  other;  you  can
  80.  even draw on the hi-res  screen  while
  81.  looking at the text screen!
  82.  
  83.  The syntax is:
  84.  
  85.    SCREEN0  selects the text screen;
  86.    SCREEN1  selects the hi-res screen.
  87.  
  88.  HUE
  89.  ---
  90.  HUE selects the colors to be  used  on
  91.  your hi-res screen; it does not change
  92.  the text screen colors.  HUE should be
  93.  used before SCREEN or WIPE.
  94.  
  95.  The syntax is:
  96.  
  97.         HUE colr,bkgd
  98.  
  99.  where "colr" is a number from 0 to 15,
  100.  corresponding to the desired color  of
  101.  the points plotted on the screen,  and
  102.  "bkgd", also between 0 and 15, is  the
  103.  background color.   (See  page  61  of
  104.  your User's Guide for the  numbers  to
  105.  use here).  If you  change  HUE  after
  106.  PLOTting points  on  the  screen,  the
  107.  color of those points will change too.
  108.  
  109.  WIPE
  110.  ----
  111.  WIPE clears your hi-resolution screen.
  112.  You should use WIPE before starting to
  113.  draw with PLOT.
  114.  
  115.  The syntax is:
  116.  
  117.         WIPE
  118.  
  119.  PLOT
  120.  ----
  121.  Now that you've  selected  your  HUEs,
  122.  WIPEd, and selected the hi-res SCREEN,
  123.  here's where the fun starts!
  124.  
  125.  Your hi-res screen is made up of 64000
  126.  points.  You can turn  each  of  these
  127.  points "on" or "off"; turning it  "on"
  128.  means that  point  will  be  the  plot
  129.  color  you've   selected   with   HUE,
  130.  instead of the background color.
  131.  
  132.  To make it easy to  find  each  point,
  133.  each of them  has  two  "coordinates",
  134.  corresponding to  its  horizontal  (X)
  135.  and vertical (Y) location.  The screen
  136.  is 320 points "across", and 200 points
  137.  "high".  The point at the  lower  left
  138.  hand corner of the screen corresponds,
  139.  in our X,Y format, to "0,0", while the
  140.  upper right hand corner  is  "319,199"
  141.  (we can't use x=320 or y=200; 0 to 319
  142.  is 320 points, and 0  to  199  is  200
  143.  points).
  144.  
  145.  To plot a point on the screen, all  we
  146.  have to  do  is  say, in  our  program
  147.  or from the keyboard:
  148.  
  149.     PLOT X,Y
  150.  
  151.  and that point is turned on!   We  can
  152.  also  plot  computed  locations;   for
  153.  example,
  154.  
  155.     PLOT 2*A,B+100
  156.  
  157.  will  work  fine,  as  long   as   the
  158.  computed values are within the  limits
  159.  above.  By plotting points repeatedly,
  160.  we can draw lines and graphic shapes.
  161.  
  162.  
  163.  Other Notes
  164.  -----------
  165.  If you make an error in your commands,
  166.  the screen will  automatically  switch
  167.  back  to  "text".   You  can   disable
  168.  BASMOD   by   hitting   RUN/STOP   and
  169.  RESTORE; if you do this, and LIST your
  170.  program, you'll see that your  special
  171.  graphics commands are now the old ones
  172.  we replaced!  Your program  won't  RUN
  173.  this  way;  you'll  probably   get   a
  174.  "syntax error" if you  try.    To  use
  175.  BASMOD after doing this, type:
  176.  
  177.     POKE1,PEEK(1)AND254
  178.  
  179.  from the keyboard.   Note that if  you
  180.  save your graphics program, you should
  181.  always  load  and  run  BASMOD  before
  182.  loading  your  program  again.   Also,
  183.  you must type in and save your program
  184.  with  BASMOD  installed,  or  the  '64
  185.  won't know what you're trying to say!
  186.  
  187.  --------------------------------------
  188.  Here's a  sample program  to  type  in
  189.  (with BASMOD in place) and  try.  This
  190.  will  draw  a  sine  wave,   and   the
  191.  horizontal axis, on the screen:
  192.  
  193.  10 wipe:hue1,0:poke53280,6:screen1
  194.  15 rem clear, set colors, select hires
  195.  20 fori=0to319
  196.  30 x=i:rem horizontal coordinate
  197.  40 y=sin(i/20)*100+100:rem vert coord
  198.  50 plotx,y:plotx,100
  199.  55 rem plot point, mark horiz axis
  200.  60 next:rem do the next point
  201.  70 geta$:ifa$=""then70:rem finished
  202.  80 screen0:end
  203.  90 rem return to text mode
  204.  
  205.  --------------------------------------
  206.  Hope you'll enjoy using BASMOD; if you
  207.  have questions, please be sure to ask!
  208.  
  209.                    SYSOP/Dave Paul
  210.                      70007,1052
  211.  
  212. (1)  (c)COMPUTE! Publications, Inc.
  213.